package com.mingqijia.gassafety.console.controller.inner;

import com.gap.basic.base.CommonResponse;
import com.mingqijia.gassafety.webserver.request.inner.ReportRequest;
import com.mingqijia.gassafety.webserver.response.StrategyReportResponse;
import com.mingqijia.gassafety.webserver.response.workorder.asst.DtuInfoH5Response;
import com.mingqijia.gassafety.webserver.service.workorder.H5Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.Map;


/**
 * @author zhangfei
 * @version 1.0.0
 * @ClassName H5Controller.java
 * @Description
 * @createTime 2022年09月21日
 */

@Slf4j
@Api(tags = "报警器数据")
@RestController(value = "H5Controller")
@RequestMapping("/inner/v1/asst/h5/")
public class H5Controller {

    @Autowired
    private H5Service h5Service;

    @ApiOperation("设备详情")
    @RequestMapping(value = "equipmentInfo", method = RequestMethod.GET)
    public CommonResponse<DtuInfoH5Response> equipmentInfo(@RequestParam("imei") String imei) {
        return CommonResponse.success(h5Service.equipmentInfo(imei));
    }

    @ApiOperation("客户详情")
    @RequestMapping(value = "consumerInfo", method = RequestMethod.GET)
    public CommonResponse<Object> consumerInfo(@RequestParam("id") String id) {
        return CommonResponse.success(h5Service.consumerInfo(id));
    }

    @ApiOperation("报告")
    @PostMapping(value = "report")
    public CommonResponse<StrategyReportResponse> report(@RequestBody @Valid  ReportRequest request) {
        return CommonResponse.success(h5Service.report(request));
    }
    @ApiOperation("报告数量")
    @GetMapping(value = "reportAmount")
    public CommonResponse<Map<String,Object>> reportAmount(@Param("subsCode") String subsCode) {
        return CommonResponse.success(h5Service.reportAmount(subsCode));
    }
}